#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @FileName  :get_lvyou.py
# @Time      :2023/10/25 
# @Author    :CL
# @email     :1037654919@qq.com
url = 'http://www.lvmama.com/lvyou/'
def get_lvyou():
    import requests

    headers = {
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
        "Accept-Language": "zh-CN,zh;q=0.9",
        "Cache-Control": "no-cache",
        "Pragma": "no-cache",
        "Proxy-Connection": "keep-alive",
        "Referer": "http://www.lvmama.com/lvyou/",
        "Upgrade-Insecure-Requests": "1",
        "User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
    }
    cookies = {
        "_ip_city_name": "%E4%B8%8A%E6%B5%B7",
        "_ip_city_place_id": "310000",
        "_ip_province_place_id": "310000",
        "uid": "wKgKb2U4c6DB6FY8N2IDAg==",
        "lvsessionid": "5e91e5ff-40d7-44d8-80c7-93b29dc8e917_16864194",
        "sajssdk_2015_cross_new_user": "1",
        "sensorsdata2015jssdkcross": "%7B%22distinct_id%22%3A%2218b6483ae6e583-00a9889c6d2904-13462c6c-2073600-18b6483ae6f94b%22%2C%22%24device_id%22%3A%2218b6483ae6e583-00a9889c6d2904-13462c6c-2073600-18b6483ae6f94b%22%2C%22props%22%3A%7B%22%24latest_traffic_source_type%22%3A%22%E7%9B%B4%E6%8E%A5%E6%B5%81%E9%87%8F%22%2C%22%24latest_referrer%22%3A%22%22%2C%22%24latest_referrer_host%22%3A%22%22%2C%22%24latest_search_keyword%22%3A%22%E6%9C%AA%E5%8F%96%E5%88%B0%E5%80%BC_%E7%9B%B4%E6%8E%A5%E6%89%93%E5%BC%80%22%7D%7D",
        "BDCCOOKIEID": "hrBhePbj3980950582",
        "BDCSESSIONID": "rSjdsWfeSHy1698217649443",
        "CoreID6": "88359017514216982176497&ci=52710000|PC",
        "Hm_lvt_cb09ebb4692b521604e77f4bf0a61013": "1698217650",
        "fp_ver": "4.5.1",
        "_ga": "GA1.2.481363095.1698217651",
        "_gid": "GA1.2.875696478.1698217651",
        "_jzqa": "1.478980885840175800.1698217652.1698217652.1698217652.1",
        "_jzqc": "1",
        "_jzqckmp": "1",
        "PHPSESSID": "21rbooo9huibt9r0drchq3h2h0",
        "cmTPSet": "Y",
        "_lvTrack_u_ud": "B014A4D3-920F-4CA4-A91C-ACAE28A90E01",
        "_qzjc": "1",
        "_lvTrack_u_sd": "A211C9DD-5D83-4934-ACE6-083FD96CCDA0",
        "_lvTrack_firstVisitTime": "1698219734719",
        "LVMM_NODE_ENV": "production",
        "_lvTrack_preVisitTime": "1698220154332",
        "__xsptplus443": "443.1.1698218363.1698220421.3%234%7C%7C%7C%7C%7C%23%23%23",
        "jXVJUTNgMEfp6rEr": "V%2BvPxLH%2BmBFGx91OSBhlLnHDxsujHAz7sDErgccMMMgKOPyPkz%2FTdY2BH4Grb%2FU0hDvRAaN1j7rweW66CMjGjx2%2Fxy%2FEvbKgaV%2FmWne0jx7wnsihyj%2BLnSxJfhrklNqpIn094EWPG51Sbvmhgd7jyKGoFvPn5%2BVCxu8mcgu%2Bt9pOEfVMn6wNLDP0eXpXNqEWhye8V9mMaUQHTvXyPS5k6tR5HqHA3VWrpS6I%2F4HvMt8twbFYKk7tzopVL20Ycf%2FTnCU9laynvIu3YpSA05FUpCBA1DZLHLAWS4clBUxou9xOKHLGvRWkURWnMMPCQjFXi9r0Ta%2BRGF3GRCQDVd4uog32uP5rNMoEiV%2F5uBU4Z7ti%2F9mgPRNzaSNQCTsWpIHa5czCVI41u9ZT8nt%2FUWADnCASUSiyCpBrxwPq8R%2BmTzY%3De4ff6bad510be49054e3a2ce8733b01187252437",
        "JSESSIONID": "3C6387C86BBB0413DD151DBDDB0ED0C0",
        "52710000|PC_clogin": "v=7&l=1698217649&e=1698222348463",
        "oIC": "233198233198233198233198",
        "oIT": "0925092509250925",
        "_qzja": "1.402745185.1698218091536.1698218091536.1698218091536.1698220363195.1698220548655.0.0.0.14.1",
        "_qzjto": "14.1.0",
        "Hm_lpvt_cb09ebb4692b521604e77f4bf0a61013": "1698220549",
        "_fmdata": "Lgnmwvb9UZV3dOw7baJRkFLIcqZ0qBmuoEw2PbzMKQxBloJQrAqlHMCiqafNRvHdslD2cIR%2FSeiSHhcrsoKHjXEzEawcHUmbzgseVRM6ytk%3D",
        "_ga_NHEPS49S4W": "GS1.2.1698217653.1.1.1698220549.0.0.0"
    }
    url = "http://www.lvmama.com/lvyou/"
    response = requests.get(url, headers=headers, cookies=cookies,timeout=10, verify=False)

    print(response.text)
    print(response)
    from bs4 import BeautifulSoup
    soups = BeautifulSoup(response.text, 'lxml')
    datas = soups.find('div',class_ ='wy_liNav_box wy_liNav_boxThree').find_all('dl')
    # print(datas)
    for data in datas:
        topic = data.find('dt').get_text()
        hrefs = [[a.get_text(),'http://www.lvmama.com/lvyou/'+a['href']] for a in  data.find_all('a')]
        print(topic,hrefs)

if __name__ == '__main__':
    get_lvyou()